Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Show the variant letter in the element title
Closes #94
What
Variants of the same code had the same title ("2.305"), so after following a variant link you could not see which variant the page showed. Now:
How
src/lib/catalog.ts:variantLetter(id)reads the letter from the end of the id (UB-2.305-b→b). All 836 ids in the data have this format.displayCode(item, hasOtherVariants)is the one rule the title and the cards share.ElementDetailHeader.tsxandElementVariants.tsxusedisplayCode.Decision
The issue asked whether the letter should be shown when a code has only one variant. I followed the suggestion in the issue: only when there are other variants, so most titles stay short.
Tests
ElementDetailHeader.test.tsx: the title with and without other variants, and two variants of the same code getting different titles.catalog.test.ts: tests forvariantLetteranddisplayCode.ElementVariants.test.tsx: the card shows its letter.Lint, type check, build and all frontend tests pass.
🤖 Generated with Claude Code